{#
@author David Alexa <alexa.david@me.com>

Copyright (C) 2012-2013 CESNET

LICENSE TERMS

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in
  the documentation and/or other materials provided with the
  distribution.
3. Neither the name of the Company nor the names of its contributors
  may be used to endorse or promote products derived from this
  software without specific prior written permission.

ALTERNATIVELY, provided that this notice is retained in full, this
product may be distributed under the terms of the GNU General Public
License (GPL) version 2 or later, in which case the provisions
of the GPL apply INSTEAD OF those given above.

This software is provided ``as is'', and any express or implied
warranties, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose are disclaimed.
In no event shall the company or contributors be liable for any
direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute
goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability, whether
in contract, strict liability, or tort (including negligence or
otherwise) arising in any way out of the use of this software, even
if advised of the possibility of such damage.
#}

<!DOCTYPE html>

<html lang="en">
<head>
	<meta charset="utf-8" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<meta name="author" content="David Alexa - alexadav@fit.cvut.cz" />
	<meta name="robots" content="noindex, nofollow" /> 

	{% stylesheets
		'bundles/fitnetopeer/style/ui-lightness/jquery-ui-1.10.3.custom.css'
		'bundles/fitnetopeer/style/pie.css'
		'bundles/fitnetopeer/style/screen.css'
		'bundles/fitnetopeer/js/bootstrap/css/bootstrap.min.css'
		filter='cssrewrite'
		output='css/stylesheet.css'
	%}
	<link rel="stylesheet" href="{{ asset_url }}" />
	{% endstylesheets %}
	{% block stylesheet %}{% endblock stylesheet %}

	{% javascripts
		'@FITNetopeerBundle/Resources/public/js/jquery-1.7.2.min.js'
		'@FITNetopeerBundle/Resources/public/js/tooltip/gips.js'
		'@FITNetopeerBundle/Resources/public/js/*'
		'@FITNetopeerBundle/Resources/public/js/bootstrap/js/bootstrap.js'
		output='js/compiled/default.js'
	%}
	<script src="{{ asset_url }}"></script>
	{% endjavascripts %}
	{% block javascripts %}{% endblock javascripts %}

	<title id="block--title">{% block title %}{% endblock title %} {% block additionalTitle %}| NetopeerWebGUI{% endblock additionalTitle %}</title>
</head>
<body>
	<div id="block--javascripts"></div>

	{% if is_granted('IS_AUTHENTICATED_FULLY') %}
		<nav id="block--topMenu">
			{% block topMenu %}
				<a href="{{ path('_home') }}" title="Home" class="static ico-home header-icon ajaxLink {% if activeAction is defined and activeAction == "home" %}active{% endif %}" data-callback="setIndexActions()"><span></span>Connections</a>
				{% if app.request.get('key') is defined and not (app.request.get('key') is empty) and lockedConn is defined %}
					{% if lockedConn == false %}
						<a href="{{ path("handleConnection", {"command": "lock", "key": app.request.get('key')} ) }}" title="Lock" class="static ico-unlock header-icon ajaxLink" data-disable-history="true" data-do-not-activate="true"><span></span></a>
					{% else %}
						<a href="{{ path("handleConnection", {"command": "unlock", "key": app.request.get('key')} ) }}" title="Unlock" class="static ico-lock header-icon ajaxLink" data-disable-history="true" data-do-not-activate="true"><span></span></a>
					{% endif %}
					<a href="{{ path("infoPage", {"key": app.request.get('key'), "action": "session"}) }}" title="Session info" class="static ico-session header-icon ajaxLink {% if activeAction is defined and activeAction == "session" %}active{% endif %}"><span></span></a>
					<a href="{{ path("reloadDevice", {"key": app.request.get('key')}) }}" title="Refresh data" class="ico-refresh header-icon ajaxLink" data-do-not-activate="true" data-disable-history="true"><span></span></a>
					{% if topmenu is defined %}
						{% set i = 0 %}
						{% for section in topmenu %}
							<a href="{{ path(section.path, section.params) }}" title="{{section.title}} ({{section.namespace}})" class="dynamic ajaxLink {% if sectionName is defined and sectionName == section.name %}active{% endif %} nth-{{i}}">{{section.name}}<span class="arrow"></span></a>
							{% set i = i + 1 %}
						{% endfor %}
						<a href="{{ path("module", {"key":app.request.get('key'),"module":'all'} ) }}" class="dynamic ajaxLink {% if sectionName is defined and sectionName|lower == "all" %}active{% endif %}" title="GET all information">All<span class="arrow"></span></a>
					{% endif %}
				{% endif %}

				<div id="alerts-icon" class="static">
					<a href="" title="Show alerts" class="static header-icon ico-alerts"><span></span><strong class="count">0</strong></a>
				</div>

				<div id="userpane" class="static">
					Logged user: <strong>{{ app.user.username }}</strong>
					{% if is_granted('IS_AUTHENTICATED_FULLY') %}<a href="{{ path('_logout') }}" class="log-out">Log out</a>{% endif %}
				</div>

				<div class="others-cover">
					<div class="show-link header-icon ico-arrow-down">
						<span></span>
						<div class="others"></div>
					</div>
				</div>
			{% endblock topMenu %}
		</nav>

		<div class="cover-wo-alerts">
		{% set addToColumnClass = '' %} {# nastaveni prazdne promenne, aby nedochazelo k vypisu nedefinovane promenne #}
		{# if submenu is defined and submenu #}
		<nav id="block--leftColumn">
			{% block leftColumn %}
				{% if sectionName is defined %}<h3>{{ sectionName }}</h3>{% endif %}
				{% for subsection in submenu %}
					<a href="{{ path(subsection.path, subsection.params) }}" title="{{subsection.title}}" class="ajaxLink {% if subsectionName is defined and subsectionName == subsection.name %}active{% endif %}">{{subsection.name}}</a>
				{% endfor %}
				{% block leftColumnAdditional %}
					{% if rpcMethods is defined and rpcMethods|length > 0 %}
					<h4>RPC methods defined in model:</h4>
					{% for rpc in rpcMethods %}
						<span class="item has-bullet"><span class="bullet"></span>{{ rpc.name }}</span>
					{% endfor %} {% endif %}
				{% endblock leftColumnAdditional %}
			{% endblock leftColumn %}
		</nav>
		{% set addToColumnClass = ' left-nav-defined' %}
		{# endif #}

		<div id="block--topPart">
			{% block topPart %}
			{% endblock topPart %}
		</div>

		{#<div class="alert-cover">#}
		{#</div>#}

		{% if singleColumnLayout == false %}
			<section id="block--state" class="column{{addToColumnClass}}">
				{% block state %}
				{% endblock state %}
			</section>
			<section id="block--config" class="column{{addToColumnClass}}">
				{% block config %}
				{% endblock config %}
			</section>
		{% else %}
			<section id="block--singleContent" class="{{addToColumnClass}}{% block singleContentClass %}{% endblock singleContentClass %}">
				{% block singleContent %}
				{% endblock singleContent %}
			</section>
		{% endif %}
		</div>

		<section class="column-alerts" id="block--alerts">
			{% block alerts %}
				{% for type, flashMessages in app.session.flashbag.all() %}
					{% set messages = array_unique(flashMessages) %}
					{% for flashMessage in messages %}
						<div class="message {{ type }}">
							<span class="circle"></span>
							<span class="close">X</span>
							{{ flashMessage|raw }}
						</div>
					{% endfor %}
				{% endfor %}
			{% endblock alerts %}
		</section>

	{% else %}
		<nav id="block--topMenu">
				<a href="{{ path('_home') }}" title="Home" id="ico-home"></a>
		</nav>

		<article id="block--singleContent">
			{% block content %}
			{% endblock content %}
		</article>
	{% endif %}

	<div id="block--notifications">
		{% block notifications %}
			<script type="text/javascript">
				$("#block--notifications").addClass('hidden');
				changeSectionHeight();
			</script>
		{% endblock notifications %}
		<div class="notif-cover"></div>
	</div>

</body>
</html>
